#!/usr/bin/env python

import resource.string.app
from twisted.internet import reactor

from _factory import Factory
from .._console import Console

class Server(Console):

    def run(self):
        self.greeting(resource.string.app)
        self.info('Press Ctrl+C to stop.\n\n')
        
        factory = Factory(self._args)
        factory.run()
        reactor.listenTCP(self._args.port, factory)
        reactor.run()
        
        self.farewell()